package org.cfg;

import com.sojoys.artifact.build.data.base.BaseCfg;
import org.base.BaseGoods;
import java.util.List;
import com.sojoys.artifact.tools.ToolMap;
import com.sojoys.artifact.tools.ToolCopy;
import com.sojoys.artifact.factory.bytebuff.IByteBuff;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.ArrayUtils;
import com.sojoys.artifact.tools.SK_String;
import com.xiaoleilu.hutool.util.StrUtil;
import com.sojoys.artifact.constant.DataModelKeyEnum;
/**
 * 灵装
 */
public class EquipmentCfg extends BaseCfg<EquipmentCfg> implements org.base.BaseGoods{

	/**
	 * 数据库表名称
	 */
	public static final String TABLE_NAME = "equipment";
	/**
	 * 完整类名称
	 */
	public static final String CLASS_NAME = "org.cfg.EquipmentCfg"; 
	/**
	 * 字段个数
	 */
	public static final int COLUMN_COUNT= 22;
	/**
	 * 数据库源字段注释
	 */
	public static final String[] SOURCE_COLUMN_REMARKS = new String[]{"","物品类型","背包类型","单格上限","超出上限转换","灵装类型","星级","负重","提供经验","初始等级","等级上限","所属组合类型","所属套装","基础属性","成长属性","基础战力","每级成长战力","特殊属性","是否支持叠加","总上限","出售收益","特殊属性等级范围",};
	/**
	 * 数据库源字段名字
	 */
	public static final String[] SOURCE_COLUMN_NAMES = new String[]{"id","superType","bagType","gridMax","convertMax","subType","star","cost","exp","initalLevel","maxLevel","combination","suit","baseAttribute","growthAttribute","combatNum","growthCombatNum","specialAttribute","pileUp","totalMax","sellProfit","specialAttrLevelRange",};
	/**
	 * 拼音字段名字
	 */
	public static final String[] PINGYING_COLUMN_NAMES = new String[]{"id","superType","bagType","gridMax","convertMax","subType","star","cost","exp","initalLevel","maxLevel","combination","suit","baseAttribute","growthAttribute","combatNum","growthCombatNum","specialAttribute","pileUp","totalMax","sellProfit","specialAttrLevelRange",};
	/**
	 * HashCode字段名字
	 */
	public static final Integer[] HASHCODE_COLUMN_NAMES = new Integer[]{3355,-332841643,-344179870,287347774,2043236017,-1868521062,3540562,3059661,100893,-1285797111,390120576,-649053489,3541773,-194519349,-400557931,-1813487630,2067836395,392907235,-988215443,-849912960,-283397066,1478021635,};
	/**
	 * 字段基本类型
	 */
	public static final String[] COLUMN_BASICTYPES = new String[]{"int","int","int","int","Map","int","int","int","int","int","int","int[]","int","Map","Map","int","int","Map","boolean","int","Map","List",};
	/**
	 * 字段引用类型
	 */
	public static final Class[] COLUMN_CLASSTYPES = new Class[]{Integer.class,Integer.class,Integer.class,Integer.class,Map.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,int[].class,Integer.class,Map.class,Map.class,Integer.class,Integer.class,Map.class,Boolean.class,Integer.class,Map.class,List.class,};
	
	/**
	 * id
	 */
	private int id;
	
	/**
	 * 物品类型
	 */
	private int superType;
	
	/**
	 * 背包类型
	 */
	private int bagType;
	
	/**
	 * 单格上限
	 */
	private int gridMax;
	
	/**
	 * 超出上限转换
	 */
	private Map convertMax;
	
	/**
	 * 灵装类型
	 */
	private int subType;
	
	/**
	 * 星级
	 */
	private int star;
	
	/**
	 * 负重
	 */
	private int cost;
	
	/**
	 * 提供经验
	 */
	private int exp;
	
	/**
	 * 初始等级
	 */
	private int initalLevel;
	
	/**
	 * 等级上限
	 */
	private int maxLevel;
	
	/**
	 * 所属组合类型
	 */
	private int[] combination;
	
	/**
	 * 所属套装
	 */
	private int suit;
	
	/**
	 * 基础属性
	 */
	private Map baseAttribute;
	
	/**
	 * 成长属性
	 */
	private Map growthAttribute;
	
	/**
	 * 基础战力
	 */
	private int combatNum;
	
	/**
	 * 每级成长战力
	 */
	private int growthCombatNum;
	
	/**
	 * 特殊属性
	 */
	private Map specialAttribute;
	
	/**
	 * 是否支持叠加
	 */
	private boolean pileUp;
	
	/**
	 * 总上限
	 */
	private int totalMax;
	
	/**
	 * 出售收益
	 */
	private Map sellProfit;
	
	/**
	 * 特殊属性等级范围
	 */
	private List specialAttrLevelRange;
	
	
	
	public static EquipmentCfg builder() {
		EquipmentCfg equipmentCfg = new EquipmentCfg();
		return equipmentCfg;
	}
	
	/**
	 * id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * 物品类型
	 */
	public int getSuperType() {
		return superType;
	}
	
	/**
	 * 背包类型
	 */
	public int getBagType() {
		return bagType;
	}
	
	/**
	 * 单格上限
	 */
	public int getGridMax() {
		return gridMax;
	}
	
	/**
	 * 超出上限转换
	 */
	public Map getConvertMax() {
		return convertMax;
	}
	
	/**
	 * 灵装类型
	 */
	public int getSubType() {
		return subType;
	}
	
	/**
	 * 星级
	 */
	public int getStar() {
		return star;
	}
	
	/**
	 * 负重
	 */
	public int getCost() {
		return cost;
	}
	
	/**
	 * 提供经验
	 */
	public int getExp() {
		return exp;
	}
	
	/**
	 * 初始等级
	 */
	public int getInitalLevel() {
		return initalLevel;
	}
	
	/**
	 * 等级上限
	 */
	public int getMaxLevel() {
		return maxLevel;
	}
	
	/**
	 * 所属组合类型
	 */
	public int[] getCombination() {
		return combination;
	}
	
	/**
	 * 所属套装
	 */
	public int getSuit() {
		return suit;
	}
	
	/**
	 * 基础属性
	 */
	public Map getBaseAttribute() {
		return baseAttribute;
	}
	
	/**
	 * 成长属性
	 */
	public Map getGrowthAttribute() {
		return growthAttribute;
	}
	
	/**
	 * 基础战力
	 */
	public int getCombatNum() {
		return combatNum;
	}
	
	/**
	 * 每级成长战力
	 */
	public int getGrowthCombatNum() {
		return growthCombatNum;
	}
	
	/**
	 * 特殊属性
	 */
	public Map getSpecialAttribute() {
		return specialAttribute;
	}
	
	/**
	 * 是否支持叠加
	 */
	public boolean getPileUp() {
		return pileUp;
	}
	
	/**
	 * 总上限
	 */
	public int getTotalMax() {
		return totalMax;
	}
	
	/**
	 * 出售收益
	 */
	public Map getSellProfit() {
		return sellProfit;
	}
	
	/**
	 * 特殊属性等级范围
	 */
	public List getSpecialAttrLevelRange() {
		return specialAttrLevelRange;
	}
	
	
	protected Object[] getColumnNames(DataModelKeyEnum e){
		switch (e) {
		case SOURCE:
			return SOURCE_COLUMN_NAMES;
		case PINGYING:
			return PINGYING_COLUMN_NAMES;
		case HASHCODE:
			return HASHCODE_COLUMN_NAMES;
		case REMARKS:
			return SOURCE_COLUMN_REMARKS;
		default:
			return PINGYING_COLUMN_NAMES;
		}
	}
	
	protected String[] getBasicTypes(){
		return COLUMN_BASICTYPES;
	}
	
	protected Class[] getClassTypes(){
		return COLUMN_CLASSTYPES;
	}
	
	protected Object[] getColumeValues(){
		Object[] values = new Object[COLUMN_COUNT];
        values[0] = this.id;
        values[1] = this.superType;
        values[2] = this.bagType;
        values[3] = this.gridMax;
        values[4] = this.convertMax;
        values[5] = this.subType;
        values[6] = this.star;
        values[7] = this.cost;
        values[8] = this.exp;
        values[9] = this.initalLevel;
        values[10] = this.maxLevel;
        values[11] = this.combination;
        values[12] = this.suit;
        values[13] = this.baseAttribute;
        values[14] = this.growthAttribute;
        values[15] = this.combatNum;
        values[16] = this.growthCombatNum;
        values[17] = this.specialAttribute;
        values[18] = this.pileUp;
        values[19] = this.totalMax;
        values[20] = this.sellProfit;
        values[21] = this.specialAttrLevelRange;
        return values;
	}
	
	protected EquipmentCfg createColumeValues(Object[] vals) {
		this.id = (int)vals[0];
		this.superType = (int)vals[1];
		this.bagType = (int)vals[2];
		this.gridMax = (int)vals[3];
		this.convertMax = (Map)vals[4];
		this.subType = (int)vals[5];
		this.star = (int)vals[6];
		this.cost = (int)vals[7];
		this.exp = (int)vals[8];
		this.initalLevel = (int)vals[9];
		this.maxLevel = (int)vals[10];
		this.combination = (int[])vals[11];
		this.suit = (int)vals[12];
		this.baseAttribute = (Map)vals[13];
		this.growthAttribute = (Map)vals[14];
		this.combatNum = (int)vals[15];
		this.growthCombatNum = (int)vals[16];
		this.specialAttribute = (Map)vals[17];
		this.pileUp = (boolean)vals[18];
		this.totalMax = (int)vals[19];
		this.sellProfit = (Map)vals[20];
		this.specialAttrLevelRange = (List)vals[21];
		return this;
	}
	
	protected Map<Object, Object> toMap(Object[] keys,Map<Object, Object> map){
        map.put(keys[0], this.id);
        map.put(keys[1], this.superType);
        map.put(keys[2], this.bagType);
        map.put(keys[3], this.gridMax);
        map.put(keys[4], this.convertMax);
        map.put(keys[5], this.subType);
        map.put(keys[6], this.star);
        map.put(keys[7], this.cost);
        map.put(keys[8], this.exp);
        map.put(keys[9], this.initalLevel);
        map.put(keys[10], this.maxLevel);
        map.put(keys[11], this.combination);
        map.put(keys[12], this.suit);
        map.put(keys[13], this.baseAttribute);
        map.put(keys[14], this.growthAttribute);
        map.put(keys[15], this.combatNum);
        map.put(keys[16], this.growthCombatNum);
        map.put(keys[17], this.specialAttribute);
        map.put(keys[18], this.pileUp);
        map.put(keys[19], this.totalMax);
        map.put(keys[20], this.sellProfit);
        map.put(keys[21], this.specialAttrLevelRange);
        return map;
    }
    
    protected EquipmentCfg createForMap(Object[] keys,Map map){
   		this.id = (int)map.get(keys[0]);
   		this.superType = (int)map.get(keys[1]);
   		this.bagType = (int)map.get(keys[2]);
   		this.gridMax = (int)map.get(keys[3]);
   		this.convertMax = (Map)map.get(keys[4]);
   		this.subType = (int)map.get(keys[5]);
   		this.star = (int)map.get(keys[6]);
   		this.cost = (int)map.get(keys[7]);
   		this.exp = (int)map.get(keys[8]);
   		this.initalLevel = (int)map.get(keys[9]);
   		this.maxLevel = (int)map.get(keys[10]);
   		this.combination = (int[])map.get(keys[11]);
   		this.suit = (int)map.get(keys[12]);
   		this.baseAttribute = (Map)map.get(keys[13]);
   		this.growthAttribute = (Map)map.get(keys[14]);
   		this.combatNum = (int)map.get(keys[15]);
   		this.growthCombatNum = (int)map.get(keys[16]);
   		this.specialAttribute = (Map)map.get(keys[17]);
   		this.pileUp = (boolean)map.get(keys[18]);
   		this.totalMax = (int)map.get(keys[19]);
   		this.sellProfit = (Map)map.get(keys[20]);
   		this.specialAttrLevelRange = (List)map.get(keys[21]);
        return this;
    }
	
	
	protected JSONObject toJSONObject(Object[] keys,JSONObject obj){
        obj.put(keys[0], this.id);
        obj.put(keys[1], this.superType);
        obj.put(keys[2], this.bagType);
        obj.put(keys[3], this.gridMax);
        obj.put(keys[4], this.convertMax);
        obj.put(keys[5], this.subType);
        obj.put(keys[6], this.star);
        obj.put(keys[7], this.cost);
        obj.put(keys[8], this.exp);
        obj.put(keys[9], this.initalLevel);
        obj.put(keys[10], this.maxLevel);
        obj.put(keys[11], this.combination);
        obj.put(keys[12], this.suit);
        obj.put(keys[13], this.baseAttribute);
        obj.put(keys[14], this.growthAttribute);
        obj.put(keys[15], this.combatNum);
        obj.put(keys[16], this.growthCombatNum);
        obj.put(keys[17], this.specialAttribute);
        obj.put(keys[18], this.pileUp);
        obj.put(keys[19], this.totalMax);
        obj.put(keys[20], this.sellProfit);
        obj.put(keys[21], this.specialAttrLevelRange);
        return obj;
    }
    
    protected EquipmentCfg createForJSONObject(Object[] keys,JSONObject obj){
	    this.id = obj.getIntValue(keys[0]);
	    this.superType = obj.getIntValue(keys[1]);
	    this.bagType = obj.getIntValue(keys[2]);
	    this.gridMax = obj.getIntValue(keys[3]);
		this.convertMax = obj.getObject(keys[4],Map.class);
	    this.subType = obj.getIntValue(keys[5]);
	    this.star = obj.getIntValue(keys[6]);
	    this.cost = obj.getIntValue(keys[7]);
	    this.exp = obj.getIntValue(keys[8]);
	    this.initalLevel = obj.getIntValue(keys[9]);
	    this.maxLevel = obj.getIntValue(keys[10]);
		this.combination = obj.getObject(keys[11],int[].class);
	    this.suit = obj.getIntValue(keys[12]);
		this.baseAttribute = obj.getObject(keys[13],Map.class);
		this.growthAttribute = obj.getObject(keys[14],Map.class);
	    this.combatNum = obj.getIntValue(keys[15]);
	    this.growthCombatNum = obj.getIntValue(keys[16]);
		this.specialAttribute = obj.getObject(keys[17],Map.class);
	    this.pileUp = obj.getBooleanValue(keys[18]);
	    this.totalMax = obj.getIntValue(keys[19]);
		this.sellProfit = obj.getObject(keys[20],Map.class);
		this.specialAttrLevelRange = obj.getObject(keys[21],List.class);
        return this;
    }
    
    protected void writeBytes(IByteBuff byteBuf){
	    byteBuf.writeInt(this.id);
	    byteBuf.writeInt(this.superType);
	    byteBuf.writeInt(this.bagType);
	    byteBuf.writeInt(this.gridMax);
	    byteBuf.writeObject(this.convertMax);
	    byteBuf.writeInt(this.subType);
	    byteBuf.writeInt(this.star);
	    byteBuf.writeInt(this.cost);
	    byteBuf.writeInt(this.exp);
	    byteBuf.writeInt(this.initalLevel);
	    byteBuf.writeInt(this.maxLevel);
	    byteBuf.writeObject(this.combination);
	    byteBuf.writeInt(this.suit);
	    byteBuf.writeObject(this.baseAttribute);
	    byteBuf.writeObject(this.growthAttribute);
	    byteBuf.writeInt(this.combatNum);
	    byteBuf.writeInt(this.growthCombatNum);
	    byteBuf.writeObject(this.specialAttribute);
	    byteBuf.writeBoolean(this.pileUp);
	    byteBuf.writeInt(this.totalMax);
	    byteBuf.writeObject(this.sellProfit);
	    byteBuf.writeObject(this.specialAttrLevelRange);
    }
	
	protected EquipmentCfg readBytes(IByteBuff byteBuf){
	    this.id = byteBuf.readInt(null);
	    this.superType = byteBuf.readInt(null);
	    this.bagType = byteBuf.readInt(null);
	    this.gridMax = byteBuf.readInt(null);
	    this.convertMax = (Map)byteBuf.readObject();
	    this.subType = byteBuf.readInt(null);
	    this.star = byteBuf.readInt(null);
	    this.cost = byteBuf.readInt(null);
	    this.exp = byteBuf.readInt(null);
	    this.initalLevel = byteBuf.readInt(null);
	    this.maxLevel = byteBuf.readInt(null);
	    this.combination = byteBuf.readIntArray(null);
	    this.suit = byteBuf.readInt(null);
	    this.baseAttribute = (Map)byteBuf.readObject();
	    this.growthAttribute = (Map)byteBuf.readObject();
	    this.combatNum = byteBuf.readInt(null);
	    this.growthCombatNum = byteBuf.readInt(null);
	    this.specialAttribute = (Map)byteBuf.readObject();
	    this.pileUp = byteBuf.readBoolean(null);
	    this.totalMax = byteBuf.readInt(null);
	    this.sellProfit = (Map)byteBuf.readObject();
	    this.specialAttrLevelRange = (List)byteBuf.readObject();
	    return this;
	}
	
	public EquipmentCfg deepCopy(){
		EquipmentCfg equipmentCfg = null;
		try {
			equipmentCfg = (EquipmentCfg) super.clone();
		    equipmentCfg.convertMax = ToolCopy.copyObject(this.convertMax);
		    equipmentCfg.combination = ToolCopy.copyObject(this.combination);
		    equipmentCfg.baseAttribute = ToolCopy.copyObject(this.baseAttribute);
		    equipmentCfg.growthAttribute = ToolCopy.copyObject(this.growthAttribute);
		    equipmentCfg.specialAttribute = ToolCopy.copyObject(this.specialAttribute);
		    equipmentCfg.sellProfit = ToolCopy.copyObject(this.sellProfit);
		    equipmentCfg.specialAttrLevelRange = ToolCopy.copyObject(this.specialAttrLevelRange);
			return equipmentCfg;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return equipmentCfg;
	}
//自定义内容起始位置

	@Override
	public String getName() {
		// TODO 自动生成的方法存根
		return null;
	}

	@Override
	public int getNameTextId() {
		// TODO 自动生成的方法存根
		return 0;
	}

	@Override
	public int getSmallType() {
		// TODO 自动生成的方法存根
		return 0;
	}

	@Override
	public int getOrder() {
		// TODO 自动生成的方法存根
		return 0;
	}

	@Override
	public int getQuality() {
		// TODO 自动生成的方法存根
		return 0;
	}


	@Override
	public Map getUseCast() {
		// TODO 自动生成的方法存根
		return null;
	}

	@Override
	public Map getUseProfit() {
		// TODO 自动生成的方法存根
		return null;
	}


	@Override
	public int getOnceUseLimit() {
		// TODO 自动生成的方法存根
		return 0;
	}

	@Override
	public Map getDealProfit() {
		// TODO 自动生成的方法存根
		return null;
	}

	/**
	 * 特殊属性权重总值
	 */
	private int specialAttrTotalWeight;

	public int getSpecialAttrTotalWeight() {
		return specialAttrTotalWeight;
	}

	public void setSpecialAttrTotalWeight(int specialAttrTotalWeight) {
		this.specialAttrTotalWeight = specialAttrTotalWeight;
	}

	@Override
	public boolean getAutoUse() {
		// TODO Auto-generated method stub
		return false;
	}

//自定义内容结束位置
}
